<?php
/**
 * Created by PhpStorm.
 * User: 17208
 * Date: 2020/9/10
 * Time: 17:23
 */
namespace extend;
class Config
{
    public static function get($value){
        // 主配置文件
        $data = require __DIR__."/../config/main.php";

        //遍历文件夹config/autoload
        $autoloadDir = __DIR__.'/../config/autoload';
        $temp=scandir($autoloadDir);
        foreach($temp as $v){
            if($v == '.' || $v == '..') continue;
            $_config = $autoloadDir.'/'.$v;
            $data[basename($v,".php")] = require $_config;
        }

        $values = explode('.',$value);
        $value = '';

        foreach ($values as $item){
            !$value && $value = $data;
            $value = $value[$item];
        }
        return $value;
    }
}